/*
 * @Description: 地图图层入口文件
 * @Date: 2022-01-06 10:49:48
 * @Author: yeming
 */

import OSM from 'ol/source/OSM'
import XYZ from 'ol/source/XYZ'
import TileLayer from 'ol/layer/Tile' // Tile翻译成中文就是“瓦片”。这项是必须的。 Tile用来承放所需的底图。

const tdtMapSource = new TileLayer({
  visible: true,
  preload: Infinity,
  maxZoom: 19,
  source: new XYZ({
    url: 'https://t2.tianditu.gov.cn/img_w/wmts?tilematrix={z}&layer=img&style=default&tilerow={y}&tilecol={x}&tilematrixset=w&format=tiles&service=WMTS&version=1.0.0&request=GetTile&tk=46686f9ceb244fed0b535a996ce2d5f8'
  })
})
const tdtRoadSource = new TileLayer({
  visible: true,
  preload: Infinity,
  maxZoom: 19,
  source: new XYZ({
    url: 'https://t2.tianditu.gov.cn/cia_w/wmts?tilematrix={z}&layer=cia&style=default&tilerow={y}&tilecol={x}&tilematrixset=w&format=tiles&service=WMTS&version=1.0.0&request=GetTile&tk=46686f9ceb244fed0b535a996ce2d5f8'
  })
})

const bianjieSource = new TileLayer({
  visible: true,
  preload: Infinity,
  maxZoom: 19,
  source: new XYZ({
    url: 'https://t0.tianditu.gov.cn/ibo_w/wmts?tilematrix={z}&layer=ibo&style=default&tilerow={y}&tilecol={x}&tilematrixset=w&format=tiles&service=WMTS&version=1.0.0&request=GetTile&tk=46686f9ceb244fed0b535a996ce2d5f8'
  })
})
// gzb 公司局域IP：192.168.30.21 本机IP：/* 127.0. */0.1
const ydMapSource = new TileLayer({
  visible: true,
  preload: Infinity,
  maxZoom: 19,
  source: new XYZ({
    url: 'http://127.0.0.1:7001/Home/MapTile/{x}/{y}/{z}'
  })
})

const ydRoadSource = new TileLayer({
  visible: true,
  preload: Infinity,
  maxZoom: 19,
  source: new XYZ({
    url: 'http://127.0.0.1:7002/Home/RoldTile/{x}/{y}/{z}'
  })
})
const ydBianJieSource = new TileLayer({
  visible: true,
  preload: Infinity,
  maxZoom: 19,
  source: new XYZ({
    url: 'http://127.0.0.1:7002/Home/BianJieTile/{x}/{y}/{z}'
  })
})

const ydTerrainSource = new TileLayer({
  visible: true,
  preload: Infinity,
  maxZoom: 19,
  source: new XYZ({
    url: 'http://127.0.0.1:7003/Home/TerrainTile/{x}/{y}/{z}.terrain'
  })
})

const OSMSource = new TileLayer({
  visible: true,
  preload: Infinity,
  maxZoom: 19,
  source: new OSM()
})

const layers = [tdtMapSource, tdtRoadSource, bianjieSource]
// const layers = [OSMSource]
// const layers = [ydMapSource, ydRoadSource, ydBianJieSource]

export default layers
